package Book;

public class BookList {
    private Book[] books=new Book[10];

    private int num;

    public BookList() {
        this.books[0]=new Book("三国演义","罗贯中",19.9);
        this.books[1]=new Book("西游记","吴承恩",38.6);
        this.books[2]=new Book("红楼梦","曹雪芹",23.3);
        this.num = 3;
    }

    public Book getBooks(int pos) {
        return books[pos];
    }

    public void setBooks(Book book) {
        this.books[this.num]=book;
        this.num++;
    }

    public int getNum() {
        return num;
    }

    public void deleteBooks(int pos){
        for (int i = pos; i < num-1; i++) {
            books[i]=books[i+1];
        }
        num--;
    }

}
